/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package verificador.proposiciones;

import java.io.File;

/**
 *
 * @author 1
 */
public class VerificadorProposiciones {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        FileManager fm = new FileManager();
        PrepositionManager pm = new PrepositionManager();
        File file;
        String [] linesOfFile;
        try{
        if( args.length >0 ) {
            for(String arg : args ) {
                file = new File(arg);
                linesOfFile = fm.readFile(file);
                for( String infix : linesOfFile){
                    String postfix = pm.infixToPostfix(infix);
                    int [] result = pm.postfixEvaluation(postfix);
                    if( result == null ) {
                        log("Expresión Malformada");
                        continue;
                    }
                    switch(pm.logicalEquivalence(result)) {
                        case PrepositionManager.TAUTOLOGY:
                            log("tautologia");
                            break;
                        case PrepositionManager.CONTINGENCY:
                            log("contingencia");
                            break;
                        case PrepositionManager.CONTRADICTION:
                            log("contradiccion");
                            break;
                    }
                }
            }
        }
        }catch(Exception e) {
            log(e.getLocalizedMessage());
        }
    }
    public static void log(String string){
        System.out.println(string);
    }
}
